package com.pronosticos.portal.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pronosticos.portal.utils.JSONResponse;

@Controller
@RequestMapping(value="/")
public class ReporteFrecuenciaController {
	/*
	@Autowired
	ReporteFrecuenciaServices reporteFrecuenciaServices;
	*/
    @RequestMapping(method=RequestMethod.GET)
    public String displaySortedMembers(Model model)
    {    	
      //  model.addAttribute("msg", "hola mundo "+reporteFrecuenciaServices.getBolaUltimoSorteo(1));        
        return "index";
    }

    /*
    @RequestMapping(method = RequestMethod.GET, value = "/listProductos")
    public @ResponseBody  String listProductos() {
    	List<TblProductos> listProductos=reporteFrecuenciaServices.findAll();
        return listProductos.get(0).toString();
    }
    
    
    @RequestMapping(method = RequestMethod.GET, value = "/listProductosJson")
    public @ResponseBody JSONResponse<List<Map<String, Object>>> listProductosJson() {
    	List<TblProductos> listProductos=reporteFrecuenciaServices.findAll();
    	
    	List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
    	for(TblProductos entity:listProductos){
    		Map<String, Object> map = JsonUtils.transform(entity, "pkProducto","descripcion");
    		list.add(map);
    	}    	
    	
    	JSONResponse<List<Map<String, Object>>> response = new JSONResponse<List<Map<String, Object>>>(list, null, true);
        response.setRecords(list.size());
        return response;
    }      
    */
    
    
    @RequestMapping(method = RequestMethod.GET, value = "/listProductosJson2")
    public @ResponseBody  JSONResponse<List<List<String>>> listProductosJson2() {
    	List<List<String>> listString=new ArrayList<List<String>>();
    	for(int v=0;v<4;v++){
	    	List<String> list = new ArrayList<String>();
	    		for(int a=0;a<5;a++){	    			
	    			list.add("AAA "+(a*v));
	    			listString.add(list);
	    		}    		
    	}
    	JSONResponse<List<List<String>>> response = new JSONResponse<List<List<String>>>(listString, null, true);    	
        return response;
    }     

}
